/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.yandex.skipass;

import java.util.Calendar;

/**
 *
 * @author Brothers
 */
public class SkiPass {

    private int id;
    private Calendar firstDate;
    private boolean access;
    private Enums.PassType type;
    private Enums.Week ogr;

    //public SkiPass(){;}
    public SkiPass(int idPass, Enums.PassType typePass,
            Calendar firstDatePass, Enums.Week ogrPass) {
        this.access = true;
        this.id = idPass;
        this.firstDate = firstDatePass;
        this.ogr = ogrPass;
        this.type = typePass;
    }

    public int getId() {
        return this.id;
    }

    public void setSkypass(int idPass, Enums.PassType typePass,
            Calendar firstDatePass, Enums.Week ogrPass) {
        this.id = idPass;
        this.firstDate = firstDatePass;
        this.ogr = ogrPass;
        this.type = typePass;
    }

    public void blockPass() {
        this.access = false;
    }

    protected void setNumberDay(int i) {
        if (this instanceof PassForAnDay) {
            this.setNumberDay(i);
        }
    }

    public boolean getPassAccess() {
        return this.access;
    }

    public Calendar getFirstDate() {
        return this.firstDate;
    }

    public boolean isValidDate(Calendar date) {
        if (this instanceof PassForSeason) {
            return this.isValidDate(date);
        } else {
            return false;
        }
    }

    public boolean isDayInOgr(Calendar day) {
        return this.ogr.takeDayConditions(day.DAY_OF_WEEK);
    }

    public void setDays(int days, int time) {
        if (this instanceof PassForAnDay) {
            this.setDays(days, time);
        }
    }

    public Enums.Week getOgr() {
        return this.ogr;
    }

    public Enums.PassType getType() {
        return this.type;
    }

}
